/*
 * @description 切换动画
 * @param {Element} element
 */
export const toggleAnimation = (element) => {
    if (!element) return;
    const value = element.getAttribute('data-toggle') === 'true';
    const container = element.querySelector('.toggle-container');
    console.log(container)
    if (!container) return;
    if (value) {
        element.style.height = '46px';
    } else {
        const { height } = container.getBoundingClientRect();
        element.style.height = `${height + 46}px`;
    }
    element.setAttribute('data-toggle', !value);
};

export const autoHeight = (element) => {
    if (!element) return;
    const container = element.querySelector('.toggle-container');
    if (!container) return;
    const { height } = container.getBoundingClientRect();
    element.style.height = `${height + 46}px`;
}
